<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <title>授权跳转</title>
    <meta name="keywords" content="keywords" />
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .content {
            margin: 0 auto;
            text-align: center;
            margin-top: 20%;
            font-size: 1.2rem;
            color:#333;
        }

        img {
            width: 10rem;
        }

        button {
            border: 0;
            outline: none;
            background-color: #04BE01;
            padding: .5rem;
            margin-top: 1rem;
            cursor: pointer;
            color: #fff;
            border-radius: .5rem;
            width: 70%;
            font-size: 1.1rem;
        }
    </style>
</head>

<body>
<div class="content">
    <c:if test="${errorCode == 2000}">
        <p><img src="<%=basePath%>images/success.png" alt=""></p>
        <p>授权成功</p>
    </c:if>
    <c:if test="${errorCode == 1012}">
        <p><img src="<%=basePath%>images/again.png" alt=""></p>
        <p>授权ID已被绑定</p>
    </c:if>
    <c:if test="${errorCode == 9999}">
        <p><img src="<%=basePath%>images/fail.png" alt=""></p>
        <p>授权失败</p>
    </c:if>
    <button onclick="jump()">点击返回app</button>
</div>
<script>
    //判断是否是安卓还是ios
    function isAndroid_ios() {
        var u = navigator.userAgent,
            app = navigator.appVersion;
        var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //android终端或者uc浏览器
        var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
        return isAndroid == true ? true : false;
    }

    function jump() {
        if(isAndroid_ios()){
            window.location.href="qnq://jp.app/openwith?SearchEngine=0";
        }else{
            alert("请去手机端打开本页面");
        }
    }
</script>
</body>

</html>